<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script src='./vue.js'></script>
    <style>
        .nav {
            width: 100%;
            height: 44px;
            line-height: 44px;
            text-align: center;
            border: 1px solid #f66;
        }

        .nav h3 {
            margin: 0;
        }

        .left {
            float: left;
            color: blue;
        }
    </style>
</head>

<body>
    <div id='app'>
        <nav-com title="首页">
            <span class="left">杭州</span>
        </nav-com>

        <nav-com title="详情">
            <span class="left">返回</span>
        </nav-com>

        <nav-com title="我的"></nav-com>

    </div>
</body>

<template id="nav">
    <div class="nav">
        <!-- slot 就是插槽 -->
        <slot></slot>

        <h3> {{ title }} </h3>
    </div>
</template>

<script>
    const app = {
        data() {
            return {}
        },
        methods: {},
        components: {
            'nav-com': {
                template: '#nav',
                props: ['title']
            }
        }
    }
    const vm = Vue.createApp(app).mount('#app')
</script>

</html>